offset 0675
 jmp $FF00
 nop			;expand check for Start button press on title
			;to also check for Select to switch mode

offset 0F35
 jsr $FF50
 nop			;jump to check for jump button press

offset 0FA8
 jsr $FF60		;jump to check for right movement
 nop

offset 0FD2
 jsr $FF70
 nop			;jump to check for left movement


;offset $7F10
;Checking for toggle on title screen:
 lda $22		;check if title is scrolling
 bne CheckForStartPress	;if so, don't allow toggle until title finishes
 lda $2C		;check button press
 and #$04		;check Select
 beq CheckForStartPress	;if 0, Select is not pressed
 txa
 pha			;not sure if X is used, preserving to be safe
 tya
 pha			;ditto for Y
 inc $FF		;control toggle flag. I THINK this is safe to use
 ldx #$16		;standard color for NAMCOT/HI SCORE text
 lda $FF		;toggle flag
 and #$01		;mask just the flag used
 sta $FF
 beq DefaultControlPalette:
 ldx #$28		;yellow color used to indicate direction movement
DefaultControlPalette:
 lda #$01
 sta $1E
WaitVblank:
 lda $1E
 bne WaitVblank		;the game used $1E as a NMI detection flag
 lda $2002		;clear vb flag
 lda #$3F
 sta $2006
 lda #$09
 sta $2006		;palette
 stx $2007		;updage NAMCOT logo color to indicate control mode
 lda $21
 sta $2005
 lda $23
 sta $2005
 pla
 tax
 pla
 tay
CheckForStartPress:
 lda $2C
 and #$08
 jmp $8669

;--------------
;Check for jump
;--------------
;offset $7F60
 lda $2C
 pha		;save button pressed info
 lda $FF	;control mode flag
 bne ReverseJump
 pla
 and #$F0	;use default control: jump if any D-pad direction pressed
 rts
ReverseJump
 pla
 and #$03	;use reverse control: jump if A or B pressed
 rts

;------------------------
;Check for right movement
;------------------------
;offset $7F70
 lda $2A
 pha		;save button held info
 lda $FF	;control move flag
 bne ReverseRight
 pla
 and #$01	;use default control: move right if A pressed
 rts
ReverseRight:
 pla
 and #$80	;use reverse control: move right if Right pressed
 rts

;-----------------------
;Check for left movement
;-----------------------
;offset $7F80
 lda $2A
 pha		;save button held info
 lda $FF	;control move flag
 bne ReverseRight
 pla
 and #$02	;use default control: move left if B pressed
 rts
ReverseRight:
 pla
 and #$40	;use reverse control: move left if Left pressed
 rts